<?xml version="1.0" encoding="utf-8"?>
<Content type="xform" name="EditContent">
  <model>
    <instance>
      <tblContent>
        <nContentKey/>
        <nContentPrimaryId/>
        <nVersion/>
        <cContentForiegnRef/>
        <cContentName/>
        <cContentSchemaName>Event</cContentSchemaName>
        <cContentXmlBrief>
          <Content>
            <Headline/>
            <StartDate/>
            <EndDate/>
            <Times start="" end="" />
            <Location loc="None" map="">
              <Venue/>
              <Address>
                <No />
                <Street />
                <Locality />
                <Region />
                <PostCode />
                <Country />
              </Address>
              <Geo longitude="" latitude="" />
            </Location>
            <Strap/>
            <Images>
              <img class="thumbnail"/>
              <img class="display"/>
              <img class="detail"/>
            </Images>
          </Content>
        </cContentXmlBrief>
        <cContentXmlDetail>
          <Content>
            <Headline/>
            <Strap/>
            <StartDate/>
            <EndDate/>
            <Times start="" end="" />
            <Location loc="None" map="">
              <Venue/>
              <Address>
                <No />
                <Street />
                <Locality />
                <Region />
                <PostCode />
                <Country />
              </Address>
              <Geo longitude="" latitude="" />
            </Location>
            <Body/>
            <Images>
              <img class="thumbnail"/>
              <img class="display"/>
              <img class="detail"/>
            </Images>
          </Content>
        </cContentXmlDetail>
        <nAuditId/>
        <nAuditKey/>
        <dPublishDate/>
        <StartDate/>
        <dExpireDate/>
        <dInsertDate/>
        <nInsertDirId/>
        <dUpdateDate/>
        <nUpdateDirId/>
        <nStatus>1</nStatus>
        <cDescription/>
      </tblContent>
    </instance>
    <submission id="EditContent" action="" method="post" event="return form_check(this)"/>
    <bind nodeset="tblContent">
      <bind id="cContentEventName" nodeset="cContentName" required="true()" type="string"/>
      <bind id="cContentBody" nodeset="cContentXmlDetail/Content/Body" required="false()" type="string"/>
      <bind id="dPublishDate" nodeset="dPublishDate" required="false()" type="string"/>
      <bind id="dEventEndDate" nodeset="dExpireDate" required="false()" type="string"/>
      <bind id="nStatus" nodeset="nStatus" required="true()" type="string"/>
      <bind id="cDescription" nodeset="cDescription" required="false()" type="string"/>
      <bind nodeset="cContentXmlBrief/Content">
        <bind id="dEventDate" nodeset="StartDate" required="false()" type="string"/>
        <bind id="dEventEndDate" nodeset="EndDate" required="false()" type="string"/>
        <bind id="cContentEventName" nodeset="Headline" required="true()" type="string"/>
        <bind id="cContentStrapline" nodeset="Strap" required="false()" type="string"/>
        <bind nodeset="Location">
          <bind id="bLocationMap" nodeset="@map" required="false()" type="string"/>
          <bind id="bLocationType" nodeset="@loc" required="false()" type="string"/>
          <bind id="cContentVenue" nodeset="Venue" required="false()" type="string"/>
          <bind nodeset="Address">
            <bind id="cContentLocationNo" nodeset="No" required="false()" type="string"/>
            <bind id="cContentLocationStreet" nodeset="Street" required="false()" type="string"/>
            <bind id="cContentLocationTown" nodeset="Locality" required="false()" type="string"/>
            <bind id="cContentLocationRegion" nodeset="Region" required="false()" type="string"/>
            <bind id="cContentLocationPostCode" nodeset="PostCode" required="false()" type="string"/>
          </bind>
          <bind nodeset="Geo">
            <bind id="cContentLocationLong" nodeset="@longitude" required="false()" type="string"/>
            <bind id="cContentLocationLat" nodeset="@latitude" required="false()" type="string"/>
          </bind>
        </bind>
        <!--<bind id="cContentTimes" nodeset="Times" required="false()" type="string"/>-->
        <bind nodeset="Times">
          <bind id="cContentSTime" nodeset="@start" required="false()" type="string"/>
          <bind id="cContentETime" nodeset="@end" required="false()" type="string"/>
        </bind>
        <bind id="cContentThumbnail" nodeset="Images/img[@class='thumbnail']" required="false()" type="xml-replace"/>
        <bind id="cContentPicture" nodeset="Images/img[@class='display']" required="false()" type="xml-replace"/>
        <bind id="cContentFullSizePicture" nodeset="Images/img[@class='detail']" required="false()" type="xml-replace"/>
      </bind>
      <bind nodeset="cContentXmlDetail/Content">
        <bind id="VenueType" nodeset="@venueType" required="false()" type="string"/>
        <bind id="dEventDate" nodeset="StartDate" required="true()" type="string"/>
        <bind id="dEventEndDate" nodeset="EndDate" required="false()" type="string" constraint="translate(//cContentXmlDetail/Content/EndDate,'-','') &gt;= translate(//cContentXmlDetail/Content/StartDate,'-','')">
          <alert>End date must be the same day or later than the Start date</alert>
        </bind>
        <!--<bind id="cContentTimes" nodeset="Times" required="false()" type="string"/>-->
        <bind nodeset="Times">
          <bind id="cContentSTime" nodeset="@start" required="false()" type="string"/>
          <bind id="cContentETime" nodeset="@end" required="false()" type="string"/>
        </bind>
        <bind id="cContentEventName" nodeset="Headline" required="true()" type="string"/>
        <bind id="cContentStrapline" nodeset="Strap" required="false()" type="string"/>
        <bind nodeset="Location">
          <bind id="bLocationMap" nodeset="@map" required="false()" type="string"/>
          <bind id="bLocationType" nodeset="@loc" required="false()" type="string"/>
          <bind id="cContentVenue" nodeset="Venue" required="false()" type="string"/>
          <bind nodeset="Address">
            <bind id="cContentLocationNo" nodeset="No" required="false()" type="string"/>
            <bind id="cContentLocationStreet" nodeset="Street" required="false()" type="string"/>
            <bind id="cContentLocationTown" nodeset="Locality" required="false()" type="string"/>
            <bind id="cContentLocationRegion" nodeset="Region" required="false()" type="string"/>
            <bind id="cContentLocationPostCode" nodeset="PostCode" required="false()" type="string"/>
          </bind>
          <bind nodeset="Geo">
            <bind id="cContentLocationLong" nodeset="@longitude" required="false()" type="string"/>
            <bind id="cContentLocationLat" nodeset="@latitude" required="false()" type="string"/>
          </bind>
        </bind>
        <bind id="cContentThumbnail" nodeset="Images/img[@class='thumbnail']" required="false()" type="xml-replace"/>
        <bind id="cContentPicture" nodeset="Images/img[@class='display']" required="false()" type="xml-replace"/>
        <bind id="cContentFullSizePicture" nodeset="Images/img[@class='detail']" required="false()" type="xml-replace"/>
      </bind>
    </bind>
  </model>
  <group ref="EditContent" class="2col">
    <label>Event</label>
    <group>
      <group>
        <label>Settings</label>
        <input bind="nContentKey" class="hidden">
          <label>ContentId</label>
        </input>
        <input bind="dPublishDate" class="calendar short">
          <label>Publish date</label>
        </input>
        <select1 bind="nStatus" appearance="full" class="vshort">
          <label>Status</label>
          <item>
            <label>Live</label>
            <value>1</value>
          </item>
          <item>
            <label>Hidden</label>
            <value>0</value>
          </item>
        </select1>
      </group>
      <group class="Content">
        <label>Images</label>
        <input bind="cContentFullSizePicture" class="short pickImage">
          <label>Main event image</label>
          <help class="inline">
            <p>
              This image should generally be no larger than <b>800x600 pixels, at 72dpi.</b>
            </p>
            <p>The main image is automatically resized for other smaller images such as thumbnails.</p>
            <p>However if you would like a different image for the thumbnail or main product page, they can be specified below.</p>
          </help>
        </input>
        <hint>Smaller images will be automatically resized from the fullsize. If you want to use alterative images you can add them here.</hint>
        <input bind="cContentThumbnail" class="short pickImage">
          <label>Alternative thumbnail</label>
        </input>
        <input bind="cContentPicture" class="short pickImage">
          <label>Alternative picture</label>
        </input>
      </group>
    </group>
    <group>
      <group>
        <label>Event Details</label>
        <group>
          <input bind="cContentEventName" class="required long">
            <label>Event name</label>
          </input>
        </group>
        <group class="inline">
          <input bind="dEventDate" class="calendar required">
            <label>Start date</label>
          </input>
          <input bind="dEventEndDate" class="calendar">
            <label>End date</label>
            <help class="inline">
              <p>
                <strong>Optional.</strong> If specified this content will expire on this date.
              </p>
            </help>
          </input>
          <input bind="cContentSTime" class="time">
            <label>Start time</label>
          </input>
          <input bind="cContentETime" class="time">
            <label>End time</label>
          </input>
        </group>
      </group>
      <group>
        <label>Location</label>
        <select1 bind="VenueType" appearance="full">
          <label>Venue Type</label>
          <item>
            <label>Related Organisation</label>
            <value>related</value>
            <toggle case="cVenue_1" event="DOMActivate"/>
          </item>
          <item>
            <label>Enter Details</label>
            <value></value>
            <toggle case="cVenue_2" event="DOMActivate"/>
          </item>
        </select1>
        <switch class="disable">
          <case id="cVenue_1">
            <label>Venue</label>
            <relatedContent type="Organisation" search="add" relationType="" direction="2way" />
          </case>
          <case id="cVenue_2">
            <group>
            <input bind="cContentVenue" class="short">
              <label>Venue name</label>
            </input>
            <!--<select bind="bLocationMap" appearance="full" class="checkboxes">
          <label>Map</label>
          <item>
            <label>Display map (*feature to come)</label>
            <value>true</value>
          </item>
        </select>-->
            <!--<select1 bind="bLocationType" appearance="full" class="multiline">
          <label>Define location</label>
          <item>
            <label>Not specified</label>
            <value>None</value>
            <toggle case="bLocationSwitch_0" event="DOMActivate"/>
          </item>
          <item>
            <label>Address</label>
            <value>address</value>
            <toggle case="bLocationSwitch_1" event="DOMActivate"/>
          </item>
          <item>
            <label>Geo positioning</label>
            <value>geo</value>
            <toggle case="bLocationSwitch_2" event="DOMActivate"/>
          </item>
        </select1>
        <switch class="disable">
          <case id="bLocationSwitch_0"/>
          <case id="bLocationSwitch_1">-->
            <group class="inline">
              <input bind="cContentLocationNo" class="vshort keep_empty">
                <label>Name or No.</label>
              </input>
              <input bind="cContentLocationStreet" class="keep_empty">
                <label>Street</label>
              </input>
              <input bind="cContentLocationTown" class="keep_empty">
                <label>Town / city</label>
              </input>
              <input bind="cContentLocationRegion" class="keep_empty">
                <label>County / region</label>
              </input>
              <input bind="cContentLocationPostCode" class="vshort keep_empty">
                <label>Postal code</label>
              </input>
              <submit submission="" ref="" class="getGeocodeButton hideRequired btn-primary" icon="fa-globe">
                <label>Get latitude and longitude from address</label>
              </submit>
            </group>
            <group class="inline">
              <input bind="cContentLocationLat" class="keep_empty">
                <label>Latitude</label>
              </input>
              <input bind="cContentLocationLong" class="keep_empty">
                <label>Longitude</label>
              </input>
            </group>
          </group>
          </case>
        </switch>
        </group>
      <group>
        <label>Tickets</label>
        <relatedContent type="Ticket" search="add" relationType="" direction="2way" />
      </group>
      <group>
        <label>Details</label>
        <textarea bind="cContentStrapline" class="TextArea xhtml" rows="6" cols="70">
          <label>Strapline details</label>
        </textarea>
        <textarea bind="cContentBody" class="TextArea xhtml" rows="20" cols="70">
          <label>Main details</label>
        </textarea>
      </group>
    </group>
  </group>
  <group ref="submit" class="contentSubmit">
    <submit submission="" ref="ewSubmit" class="principle">
      <label>Save Event</label>
    </submit>
  </group>
</Content>
